<template xmlns:el-col="http://www.w3.org/1999/html">
  <el-main>
    <h2>收房合同查询</h2>
    <el-form ref="form" :model="form" label-width="80px">
      <el-row>
        <el-col :span="12">
        <el-form-item label="收房合同编号">
          <el-input v-model="form.sfContractNo" placeholder="请输入收房合同编号" style="width: 200px"></el-input>
        </el-form-item>
        </el-col>
        <el-col :span="12">
        <el-form-item label="业主姓名">
          <el-input v-model="form.ownerName" placeholder="请输入业主姓名"  style="width: 200px"></el-input>
        </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="12">
        <el-form-item label="小区名称">
          <el-input v-model="form.premiseName" placeholder="请输入小区名称" style="width: 200px"></el-input>
        </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="合同录入日期">
            <el-date-picker
              v-model="form.inputDateStart"
              type="date"
              value-format="yyyy-MM-dd">
            </el-date-picker>至
            <el-date-picker
              v-model="form.inputDateEnd"
              type="date"
              value-format="yyyy-MM-dd">
            </el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
        <el-button @click="empty">清空</el-button>
      </el-form-item>
    </el-form>

    <template>
      <el-table
        :data="tableData"
        style="width: 100%">
        <el-table-column
          prop="sfContractNo"
          label="合同编号"
          width="180">
        </el-table-column>
        <el-table-column
          prop="premiseName"
          label="小区"
          width="180">
        </el-table-column>
        <el-table-column
          prop="signUserMobile"
          label="电话">
        </el-table-column>
        <el-table-column
          prop="leaseStartTime"
          label="起租日期">
        </el-table-column>
        <el-table-column
        prop="leaseEndTime"
        label="结束日期">
        </el-table-column>
        <el-table-column
          prop="conInfoTime"
          label="录入日期">
        </el-table-column>
        <el-table-column
          prop="conAudTime"
          label="审核日期">
        </el-table-column>
        <el-table-column
          prop="ownerName"
          label="业主">
        </el-table-column>
        <el-table-column
          prop="userName"
          label="操作人">
        </el-table-column>
        <el-table-column
          prop="address"
          label="操作">
          <template slot-scope="scope">
            <el-link type="warning">导入还款计划</el-link>
          </template>
        </el-table-column>
      </el-table>
    </template>

    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="[1, 2, 5, 10]"
      :page-size="form.pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </el-main>
</template>

<script>
  import { list } from "@/api/shoufang/shoufang";

  export default {
    name: "shoufangquery",
    data(){
      return{
        form:{
          pageNum:1,
          pageSize:5,
        },
        value1: '',
        tableData:[],
        total: 0,
        currentPage:0,
      }
    },
    methods:{
      handleSizeChange(pageSize) {
        this.form.pageSize=pageSize;
        this.onSubmit();
      },
      handleCurrentChange(pageNum) {
        this.form.pageNum=pageNum;
        this.onSubmit();
      },
      onSubmit() {
        console.log(this.form)
        list(this.form).then(Response=>{
          console.log(Response);
          this.tableData=Response.data.list;
          this.currentPage=Response.data.pageNum;
          this.total=Response.data.total;
        })
      },
      empty() {
        this.form={pageNum:1,
          pageSize:5,};
      }
    },
    created() {
      this.onSubmit();
    }
  }
</script>

<style scoped>

</style>
